class Soldier:
    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.health = 100
        self.is_alive = True

    def take_damage(self, damage):
        if not self.is_alive:
            return
        self.health -= damage
        if self.health <= 0:
            self.health = 0
            self.is_alive = False
            print(f"{self.name} 被击败了！")

class Police(Soldier):
    def __init__(self, name, age):
        super().__init__(name, age)
        self.damage = 10

    def shoot(self, enemy):
        print(f"警察 {self.name} 开枪射击恐怖分子 {enemy.name}！")
        enemy.take_damage(self.damage)

class Terrorist(Soldier):
    def __init__(self, name, age):
        super().__init__(name, age)
        self.damage = 5

    def shoot(self, enemy):
        print(f"恐怖分子 {self.name} 开枪射击警察 {enemy.name}！")
        enemy.take_damage(self.damage)
# 创建角色
police = Police("张警官", 35)
terrorist = Terrorist("阿飞", 28)

# 模拟对战：警察先开枪，恐怖分子还击
round_count = 1
while police.is_alive and terrorist.is_alive:
    print(f"\n===== 第 {round_count} 回合 =====")
    police.shoot(terrorist)
    if not terrorist.is_alive:
        break
    terrorist.shoot(police)
    round_count += 1

# 结束战斗
if police.is_alive:
    print("\n警察胜利！")
else:
    print("\n恐怖分子胜利！")
